import { defineConfig } from "vite";
import { resolve } from 'path';
import { createHtmlPlugin } from "vite-plugin-html";

export default defineConfig({
  appType: "mpa",
  base: './',
  root: "src",
  server: {
    open: "/index.html",
    host: true,
  },
  plugins: [
    createHtmlPlugin({
      minify: true,
    }),
  ],
  build: {
    outDir: "../dist",
    emptyOutDir: true,
    minify: true,
    cssMinify: "LightningCSS",
    rollupOptions: {
      input: {
        index: resolve(__dirname, "src/index.html"),
        join: resolve(__dirname, "src/join.html"),
        work: resolve(__dirname, "src/work.html"),
        contact: resolve(__dirname, "src/contact.html"),
      },
      output: {
        compact: true,
        assetFileNames: 'assets/[hash][extname]'
      },
    },
  },
  css: {
    LightningCSS: {},
  },
});
